<!-- 表单修改 -->

<template>
  <WebForm :disabled="!one.id">
    <EasyRow col4>
      <FormInput :label="`${CORE.MAP.ORGAN}名称`" bind="name" :max="20" required />
      <FormInput :label="`${CORE.MAP.ORGAN}编号`" bind="code" :max="20" required />
      <EasyRow class="half">
        <FormNum :label="`${CORE.MAP.ORGAN}排序`" bind="sort" :min="1" :max="999" tip="请输入" fifth2 required />
        <MyUser class="fifth3" />
      </EasyRow>
    </EasyRow>

    <EasyRow col2>
      <FormTree :label="`上级${CORE.MAP.ORGAN}`" bind="parentId" :dict="treeDict" allName disabled />
      <FormTree :label="`所在${CORE.MAP.REGION}`" bind="regionId, regionName" :dict="CORE.REGION.DICT" allName />
    </EasyRow>

    <EasyRow col4>
      <FormSelect
        :label="`${CORE.MAP.ORGAN}类型`"
        bind="organTypeId, organTypeValue"
        :dict="CORE.DICT.dept_type"
        required
      />
      <FormCheckbox label="应用范围" bind="applicationScope" :dict="DICT.SCOPE" quar3 />
    </EasyRow>

    <FormTextarea :label="`${CORE.MAP.ORGAN}描述`" bind="describe" :max="20" :rows="2" />

    <EasyRow v-for="(item, i) in one.propList" :key="item.label" flex>
      <FormTextarea v-bind="getPropertyProps(item)" />
      <FormSlot noLabel flex0>
        <BtnDanger plain @click="delProp(i)"><i class="el-icon-minus" /></BtnDanger>
      </FormSlot>
    </EasyRow>

    <EditButton>
      <BtnPrimary title="扩展属性" plain @click="prop_openEdit(prop_INIT_ONE)" />
    </EditButton>
  </WebForm>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import FormAdd from '../FormAdd'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'FormEdit',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb(), CORE.mixTree(), CORE.mixWeb('prop', 'prop_')],

  /**
   * 组件导入 (Abc.vue + Abc/index.vue)
   */
  ...CORE.components(
    require.context('@admin/views/System/Dict/DictData/FormEdit', true, /vue$/),
    require.context('./', true, /vue$/),
  ),

  /**
   * 本地方法 (轻量重要在前)
   */
  methods: FormAdd.methods,
}
</script>
